/*
 * PSDetectLeader.java
 *
 * Created on 10 de noviembre de 2007, 08:09 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package Behaviors.Schemas.Perception;
import Behaviors.Schemas.Vector2dSchema;
import Robot.*;
import Util.Vector2d;
import Util.Pose2d;
/**
 *
 * @author alejo
 *
 * Class used to implement a Perceptual Schema that identifies the position
 * of the leader.
 */
public class PSDetectLeader implements Vector2dSchema{
    
    Position2d leaderPosition;
    /** Creates a new instance of PSDetectLeader */
    public PSDetectLeader(Position2d leaderPosition) {
        this.leaderPosition = leaderPosition;
    }
    
    
    public Vector2d Value() {
        
        Pose2d leaderPose = leaderPosition.read(RealPosition2d.READ_MODE_NO_WAIT);
        
        return new Vector2d(leaderPose.getPx(),leaderPose.getPy(),Vector2d.MODE_XY);
    }
}
